<template>

  <div>
    <h1>提交成功！</h1>
    点击返回
    <el-link style="font-size: 20px; color: #55a532" @click="toEvaluate">评估程序</el-link>
    <el-link style="font-size: 20px; color: #795da3" @click="toData">数据管理</el-link>
    <h2>{{count}}秒后跳转到<el-link style="font-size: 20px; color: #df5000" @click="toHome">首页</el-link></h2>
  </div>
</template>

<script>
    export default {
        name: "Success",
      data(){
          return{
            count:"",//倒计时
          }
      },
      created(){
          this.threeGo();
      },
      methods:{
          toHome(){
            clearInterval(this.timer);
            this.timer = null;
            this.$router.push({path:'/'})
          },
        toEvaluate(){
          clearInterval(this.timer);
          this.timer = null;
          this.$router.replace({path:'/evaluate/evaluate'})
        },
        toData(){
          clearInterval(this.timer);
          this.timer = null;
          this.$router.push({path:'/sys/data'})
        },
        threeGo(){
          const TIME_COUNT = 5;
          if(!this.timer){
            this.count = TIME_COUNT;
            this.show = false;
            this.timer = setInterval(()=>{
              if(this.count > 0 && this.count <= TIME_COUNT){
                this.count--;
              }else{
                this.show = true;
                clearInterval(this.timer);
                this.timer = null;
                //跳转的页面写在此处
                this.$router.push({
                  path: '/'
                });
              }
            },1000)
          }
        },

      }
    }

</script>

<style scoped>

</style>
